<template>
    <div>
        <div v-if="props.data && props.data.length" class="task-list-container">
            <TaskItem
                v-for="item in props.data"
                :key="item.id"
                :data="item"
                :is-buy-person="isBuyPerson"
                :is-creater="isCreater"
                :is-preview="isPreview"
                @obtain-course="emit('obtain-course')"/>
        </div>
        <div class="no-data" v-else>
			<NoData info="暂无测试" url="no-data@2x.png" />
		</div>
    </div>
</template>

<script setup>
import TaskItem from './item.vue';
import NoData from '@/components/no-data.vue';
const props = defineProps({
    data: {
        type: Array,
        default: () => []
    },
    isCreater: { // 是否是创建者
        type: Boolean,
        default: false
    },
    isBuyPerson: { // 是否是购买者
        type: Boolean,
        default: false
    },
    isPreview: { // 是否是预览状态
        type: Boolean,
        default: false 
    }
});

const emit = defineEmits(['obtain-course']);
</script>

<style lang="scss" scoped>
.task-list-container {
    margin-top: -20px;
}
</style>